import 'package:concert_ticket_client/app/modules/concert/views/concert_view.dart';
import 'package:concert_ticket_client/app/modules/home/views/home_view.dart';
import 'package:concert_ticket_client/app/modules/user/views/user_view.dart';
import 'package:concert_ticket_client/app_config.dart';
import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../controllers/application_controller.dart';

class ApplicationView extends GetView<ApplicationController> {
  ApplicationView({super.key});

  BottomNavigationBar buildBottomNavigationBar() {
    return BottomNavigationBar(
      items: const [
        BottomNavigationBarItem(
          icon: Icon(Icons.home),
          label: '门票',
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.music_video),
          label: '演唱',
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.person),
          label: '我的',
        ),
      ],
      currentIndex: controller.menuIndex.value,
      onTap: (index) {
        controller.menuIndex.value = index;
      },
    );
  }

  List<Widget> menuPageList = [HomeView(), ConcertView(), UserView()];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Obx(() => menuPageList[controller.menuIndex.value]),
      ),
      bottomNavigationBar: Obx(buildBottomNavigationBar)
    );
  }
}
